﻿/*****************************************介绍*****************************************
 * 作者：24531
 * 创建时间：2025-09-07 18:47:18
 * 功能：界面【LevelFailureSettlePanel】的View
        1、负责收集所有控件
**************************************************************************************/

using DG.Tweening;
using Game.Framework;
using Game.UI.GamePanel;

namespace Game.UI.LevelFailureSettlePanel
{
    public class LevelFailureSettlePanelView : PopupPanel
    {
        public const string PANEL_KEY = "Game_UI_LevelFailureSettlePanel_LevelFailureSettlePanel_Key";
        private GamePanelView m_GameView;

        protected override void RegistAny()
        {
            PanelManager.Instance.RegistPanel(PANEL_KEY, this);
        }

        protected override void UnregistAny()
        {
            PanelManager.Instance.UnregistPanel(PANEL_KEY);
        }

        public override void Init(object data)
        {
            m_GameView = data as GamePanelView;
            GetRect(LevelFailureSettlePanelNotifications.Icon_RECT).DOScale(1.3f, .5f).SetLoops(-1, LoopType.Yoyo);
        }

        protected override void ClickBtnHandle(string name)
        {
            switch (name)
            {
                case LevelFailureSettlePanelNotifications.RestartBtn_CTRL:
                    m_GameView.Restart();
                    break;
                case LevelFailureSettlePanelNotifications.BackLobbyBtn_CTRL:
                    UIUtility.HidePanel(GamePanelView.PANEL_KEY);
                    break;
            }
            UIUtility.HidePanel(PANEL_KEY);
        }
    }
}